﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.SqlClient;
using System.Configuration;

public partial class IntervieweeFormV2 : System.Web.UI.Page
{
    private string RGender;
    private string RCStatus;
    string RExperience;
    string WExperience;
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    
    
    protected void ButtonSubmitInterviewForm_Click(object sender, EventArgs e)
    {
        string CS = ConfigurationManager.ConnectionStrings["DBCS"].ConnectionString;
        using (SqlConnection con = new SqlConnection(CS))
        {
            SqlCommand cmd = new SqlCommand("spAddInterviewee", con);
            cmd.CommandType = System.Data.CommandType.StoredProcedure;

            if (RadioButtonMale.Checked)
                RGender = "Male";

            else
                RGender = "Female";

            if (RadioButtonSingle.Checked)
                RCStatus = "Single";
            else
                RCStatus = "Married";

            if (RadioButtonExperienceNo.Checked)
                RExperience = "No";
            else
                RExperience = "Yes";

            WExperience = RExperience + ", " + DropDownListExperienceYes.SelectedValue;


            cmd.Parameters.AddWithValue("@FName", TextBoxFName.Text);
            cmd.Parameters.AddWithValue("@MName", TextBoxMName.Text);
            cmd.Parameters.AddWithValue("@LName", TextBoxLName.Text);
            cmd.Parameters.AddWithValue("@Gender", RGender);
            cmd.Parameters.AddWithValue("@CStatus",RCStatus);
            cmd.Parameters.AddWithValue("@RAddress", TextBoxAddress.Text);
            cmd.Parameters.AddWithValue("@Contactno", TextBoxContactNo.Text);
            cmd.Parameters.AddWithValue("@Gpa", TextBoxGPA.Text);
            cmd.Parameters.AddWithValue("@Class", DropDownListClass.SelectedValue);
            cmd.Parameters.AddWithValue("@Alstream", DropDownListALStream.SelectedValue);
            cmd.Parameters.AddWithValue("@WorkExperience", WExperience);

            con.Open();
            cmd.ExecuteNonQuery();

            LabelIFormRegStatus.Text = "Application Sent!";
            

        }
    }
    
}